import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function getReptObjData(pk_psnjob, callback) {

    const {orgVal} = this.props;

    let postData = {
        func_type: 3,
        pk_org: orgVal.refpk,
        pk_psnjob
    };

    return proFetch({
        url: '/nccloud/hrhi/psndoc/PsndocQueryReptObjectAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                const columns = res.data.table.map(item => {
                    return {
                        title: item.display, dataIndex: item.key, key: item.key
                    }
                });
                callback && callback({
                    columns,
                    data: res.data.data
                });
            }
        });
}
